package cn.cdeden.knowledge.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * TODO
 *
 * @author username
 * @date 2023/11/17 10:31
 * @describe:
 **/
@Getter
@AllArgsConstructor
public enum PermTypeEnum {
    USER(0,"user"), //人员
    DEPT(1,"dept"), //部门
    JOB(2,"job"), //岗位
    ROLE(3,"role"); //角色
    private final Integer permTypeCode;
    private final String permTypeName;

    public static PermTypeEnum getPermTypeEnum(Integer permTypeCode){
        if (permTypeCode == null)return null;
        for (PermTypeEnum value : PermTypeEnum.values()) {
            if (value.getPermTypeCode() == permTypeCode)return value;
        }
        return null;
    }

    public static PermTypeEnum getPermTypeEnum(String permTypeName){
        if (permTypeName == null)return null;
        for (PermTypeEnum value : PermTypeEnum.values()) {
            if (value.getPermTypeName().equals(permTypeName))return value;
        }
        return null;
    }
}
